
package com.wwy.monitor.mapper.tddl;

import com.wwy.monitor.model.tddl.dto.MonitorIpDTO;
import com.wwy.monitor.model.tddl.query.MonitorIpQuery;
import com.wwy.monitor.model.tddl.vo.MonitorIpVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author tianquan.ld
 * @version V1.0
 * <p>Description: çæ§ip mapper</p>
 * @date 2019-10-29 15:59
 */
@Repository
public interface MonitorIpMapper {
    /**
     * æ°å»º
     *
     * @param entity
     * @return
     */
    int insert(MonitorIpDTO entity);

    /**
     * æ¹éæ°å 
     *
     * @param list
     * @return
     */
    int batchInsert(@Param("list") List<MonitorIpDTO> list);

    /**
     * æ ¹æ®æºå¨ipIdè¿è¡¨æ¥è¯¢appç¶æ
     *
     * @param id ipId
     * @return appç¶æ
     */
    Integer selectAppStatusByIpId(@Param("id") Long id);

    /**
     * æ ¹æ®åºç¨idè·åææipåè¡¨
     *
     * @param appId åºç¨id
     * @return ipåè¡¨
     */
    List<MonitorIpDTO> getAllIpByAppId(@Param("appId") Long appId, @Param("ip") String ip);

    /**
     * æ¹éé»è¾å é¤
     */
    int deleteByIds(@Param("list") List<Integer> ids);

    /**
     * å é¤
     *
     * @param id
     * @return
     */
    int deleteById(@Param("id") Long id);

    /**
     * æ ¹æ®appIdé»è¾å é¤ip
     *
     * @param appId åºç¨id
     * @return å é¤æ¡æ°
     */
    int deleteByAppId(@Param("appId") Long appId);

    /**
     * æ ¹æ®appIdé»è¾å é¤ip
     *
     * @param list åºç¨ids
     * @return å é¤æ¡æ°
     */
    int deleteByAppIds(@Param("list") List<Long> list);

    /**
     * æ´æ°
     *
     * @param entity
     * @return
     */
    int updateById(MonitorIpDTO entity);

    /**
     * æ ¹æ®åºç¨idä¸çº¿æºå¨
     *
     * @param appId åºç¨id
     * @return ä¸çº¿æºå¨æ¡æ°
     */
    int offlineIpByAppId(Long appId);

    /**
     * æ¥è¯¢è§å
     *
     * @return
     */
    List<MonitorIpDTO> selectByQuery(MonitorIpQuery query);

    /**
     * è¿è¡¨æ¥è¯¢
     *
     * @return
     */
    List<MonitorIpVO> queryMonitorIp(MonitorIpQuery query);

    /**
     * æ ¹æ®idæ¥è¯¢
     *
     * @param id
     * @return
     */
    MonitorIpDTO selectById(@Param("id") Long id);

    /**
     * æ»æ°
     *
     * @param query
     * @return
     */
    Integer count(MonitorIpQuery query);

    /**
     * æ ¹æ®åºç¨idæ¥è¯¢æºå¨åè¡¨
     *
     * @param appIdList
     * @return
     */
    List<MonitorIpDTO> selectByAppIds(@Param("appIdList") List<Long> appIdList, @Param("status") Integer status, @Param("env") Integer env);
}